import java.io.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 22652
 * Date: 2024-04-27
 * Time: 16:40
 */
public class demo_6 {
    public static void main(String[] args) throws IOException {
        try (OutputStream os = new FileOutputStream("src/hello.txt")) {
            try (OutputStreamWriter osWriter = new OutputStreamWriter(os, "UTF-8")) {
                try (PrintWriter writer = new PrintWriter(osWriter)) {
                writer.println("我是第一行");
                writer.print("我的第二行\r\n");
                writer.printf("%d: 我的第三行\r\n", 1 + 1);
                writer.flush();
            }
        }
    }
}
}
